package org.example.day20240827.Demo;

import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;

public class MapDemo {
    public static void main(String[] args) {
        Map<String,String> dicMap = new HashMap<>();
//        Map<String,String> dicMap = new TreeMap<>();
//        Map<String,String> dicMap = new HashMap<>();
        dicMap.put("1","苹果");
        dicMap.put("2","梨");
        dicMap.put("3","香蕉");
        dicMap.put("3","banana");
        dicMap.put("4","菠萝");
        dicMap.put("5","西瓜");
        dicMap.put("6","葡萄");
        dicMap.put("7","蜜瓜");
        dicMap.put("8","山竹");
        dicMap.put("9","百香果");
//        dicMap.remove("パインアップル");
        System.out.println(dicMap.get("バナナ"));
        System.out.println(dicMap);
        if(dicMap.containsKey("バナナ")){
            System.out.println("contain");
        }
        if(dicMap.containsValue("梨")){
            System.out.println("contain");
        }
        for (String key : dicMap.keySet()){
            System.out.print(key);
            System.out.print(dicMap.get(key));
            System.out.println();
        }
        System.out.println("*****************");
        for (Map.Entry<String,String> entry : dicMap.entrySet()){
            System.out.print(entry.getKey());
            System.out.print(entry.getValue());
            System.out.println();
        }
    }
}
